export const formatMoney = (value) => {
  const str = (value || '0').toString()
  const reg = /(\d)(?=(?:\d{3})+$)/g
  return `¥${str.replace(reg, '$1,')}`
}

export const computeRate = (a, b) => {
  return !b ? 0.0 : (a * 100.0) / b
}

export const formatRate = (value) => {
  if (value == null || value === undefined) {
    return '--'
  }
  return `${value.toFixed(2)}%`
}
